<template>
	<view class="update-price">
		<view class="update-price__title">当前的报价是：<text class="price-text"> {{price}} 万</text></view>
		<view class="update-price__content">
			<view class="update-price__qrcode">
        <ui-textbox  placeholder="请输入新的报价"
                    v-model="formData.markPrice"
        ></ui-textbox>
			</view>
		</view>
    <view class="sell-box"  @click="handleVehicleCreateClick">
      <view class="sell-box-fast" >点击提交</view>

    </view>
	</view>
</template>

<script>
import {error, success} from "@huntianning/miniprogram/components/ui-message/ui-message.js";
import { updateTVehicleInfo } from '@/apis/order.js';

export default {
	name: 'UpdatePrice',
  props: {
      price: {
        type: Number,
        default: ''
      },
      vehicleId: {
        type: String,
        require: true
      }
  },
  data () {
    return {
      formData: {
        markPrice: '',
        vehicleId: ''
      }
    }
	},
  created() {
  },
	methods: {
    handleVehicleCreateClick(vehicleStatus){
      if(!this.formData.markPrice){
        error("请输入新的报价！")
        return
      }
      this.formData.vehicleId=this.vehicleId
      return updateTVehicleInfo(this.formData).then((res) => {
        uni.navigateBack()
        this.$emit('confirm')
        let successText='修改成功！'
        setTimeout(() => {
          success(successText)
        }, 100)
      })

    },
		handleConfirmClick () {
			this.$emit('confirm')
		}
	}
}
</script>

<style lang="less">
.update-price{
	background-color: #fff;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	align-items: normal;
	justify-content: center;
	min-width: 300px;
}
.update-price__title{
	font-weight: 500;
	padding: 20px 20px 0;
  font-size: 35rpx;
  .price-text{
    color: #F47554;
  }
}
.update-price__content{
	padding: 20px;
}
.update-price__qrcode{
	width: 136px;
	height: 50px;
	margin-bottom: 6px;
}
.update-price__tips{
	font-size: 12px;
	color: #999;
	text-align: center;
}
.update-price__action{
	border-top: 1px solid rgba(0,0,0,0.1);
	height: 54px;
	line-height: 54px;
	font-size: 17px;
	color: #576B95;
	text-align: center;
	width: 100%;
	&:active {
		background-color: rgba(0,0,0,.04);
	}
}
.sell-box{
  border-radius: 20rpx;
  margin: 15rpx;
  width: 100%;
  height: 110rpx;
  text-align: center;
  padding-top: 15rpx;
}
.sell-box-fast{
  text-align: center;
  margin-top: 10rpx;
  text-align: center;
  padding-top: 10rpx;
  border-radius: 20rpx;
  height: 50rpx;
  background-color: #F47554;
  margin-left:100rpx ;
  margin-right:100rpx ;
  color: white;
  font-size: 35rpx;
  font-weight: bold;
}
</style>